package com.yc.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yc.entity.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.SpringSecurityCoreVersion;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.util.Assert;

import java.io.Serializable;
import java.util.*;

/**
 * 学生表;
 * @date : 2023-6-28
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "学生表")
@TableName(value ="student_info" , autoResultMap = true)
public class StudentInfo extends BaseEntity implements Serializable,Cloneable, UserDetails {
    /** 主键 */
    @ApiModelProperty(name = "主键",notes = "")
    @TableId(value = "id", type = IdType.AUTO)
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Integer id ;
    /** 学号 */
    @ApiModelProperty(name = "学号",notes = "")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private String stuid ;
    /** 密码 */
    @ApiModelProperty(name = "密码",notes = "")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private String password ;
    /** 名字 */
    @ApiModelProperty(name = "名字",notes = "")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private String sname ;
    /** 性别 */
    @ApiModelProperty(name = "性别",notes = "")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Integer ssex ;
    /** 手机号 */
    @ApiModelProperty(name = "手机号",notes = "")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private String sphone ;
    /** 班级ID */
    @ApiModelProperty(name = "班级ID",notes = "")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Integer cid ;
    /** 微信appid */
    @ApiModelProperty(name = "微信appid",notes = "")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private String appid ;
    /** 微信头像 */
    @ApiModelProperty(name = "微信头像",notes = "")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private String wxpic ;
    /** 手机设备码 */
    @ApiModelProperty(name = "手机设备码",notes = "")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private String imei ;
    /**
     * 班长 1 或学委  2
     */
    @ApiModelProperty(name = "备用字段",notes = "")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private String spare ;
    @TableField(exist = false)
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private String  rolecode ="STUDENT";

    public StudentInfo(String stuid,String rolecode){

    }
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }
    @Override
    public String getUsername() {
        return this.stuid;
    }
    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }

    @TableField(exist = false)
    private Integer currentPage;
    @TableField(exist = false)
    private Integer pageSize;
}
